

const express = require("express")
const bodyParser = require("body-parser")
const ejs = require("ejs")

// 引入路由模块login
const login = require("./routes/login")

const app = express()

// 配置化模板引擎
app.engine("html",ejs.__express)
app.set("view engine","html")  // ejs模板文件名修改后缀为html

// 配置静态资源目录
app.use(express.static("static"))

// 配置第三方中间件bodyParser
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())

// 挂载路由模块
app.use("/login", login)


app.get("/", (req, res) => {
    res.send("首页")
})


app.listen(3000, () => {
    console.log("app is running...")
})